
/**
 * This class provide field to be filled while creating control message 
 * which can be used through getter and setter methods.
 * 
 * @author pkulkar@ncsu.edu
 */

package com.android.networking.message;

public class ControlPacket {
	private static final char preamble='C';
	private int checksum; // length of data + 1 for simplicity
	private int requestType;
	private String sourceIP;
	private int sourcePort;
	private String destinationIP;
	private int destinationPort;
	private int sourceConnID;
	private String muticastIP;
	private int score;
	private int lengthOfExtraData;
	private String extraData;
	private static final char postamble='C';
	
	public String getMuticastIP() {
		return muticastIP;
	}
	public void setMuticastIP(String muticastIP) {
		this.muticastIP = muticastIP;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	public int getLengthOfExtraData() {
		return lengthOfExtraData;
	}
	public void setLengthOfExtraData(int lengthOfExtraData) {
		this.lengthOfExtraData = lengthOfExtraData;
	}
	public String getExtraData() {
		return extraData;
	}
	public void setExtraData(String extraData) {
		this.extraData = extraData;
	}
	private int getChecksum() {
		return checksum;
	}
	private void setChecksum(int checksum) {
		this.checksum = checksum;
	}
	public int getRequestType() {
		return requestType;
	}
	public void setRequestType(int requestType) {
		this.requestType = requestType;
	}
	public String getSourceIP() {
		return sourceIP;
	}
	public void setSourceIP(String sourceIP) {
		this.sourceIP = sourceIP;
	}
	public int getSourcePort() {
		return sourcePort;
	}
	public void setSourcePort(int sourcePort) {
		this.sourcePort = sourcePort;
	}
	public String getDestinationIP() {
		return destinationIP;
	}
	public void setDestinationIP(String destinationIP) {
		this.destinationIP = destinationIP;
	}
	public int getDestinationPort() {
		return destinationPort;
	}
	public void setDestinationPort(int destinationPort) {
		this.destinationPort = destinationPort;
	}
	public int getSourceConnID() {
		return sourceConnID;
	}
	public void setSourceConnID(int sourceConnID) {
		this.sourceConnID = sourceConnID;
	}
	
	public void computeChecksum(){
		this.setChecksum(100);
	}
	
	public void displayControlPacket(){
		System.out.println("preamble          ==>"+preamble);
		System.out.println("checksum          ==>"+checksum); // length of data + 1 for simplicity
		System.out.println("requestType       ==>"+requestType);
		System.out.println("sourceIP          ==>"+sourceIP);
		System.out.println("sourcePort        ==>"+sourcePort);
		System.out.println("destinationIP     ==>"+destinationIP);
		System.out.println("destinationPort   ==>"+destinationPort);
		System.out.println("sourceConnID      ==>"+sourceConnID);
		System.out.println("muticastIP        ==>"+muticastIP);
		System.out.println("score             ==>"+score);
		System.out.println("lengthOfExtraData ==>"+lengthOfExtraData);
		System.out.println("extraData         ==>"+extraData);
		System.out.println("postamble         ==>"+postamble);
	}
}
